cmake_minimum_required(VERSION 3.0)
project(AsyncLog)

set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")             # c++17
set(CMAKE_CXX_FLAGS "-g ${CMAKE_CXX_FLAGS}")                     # 调试信息
set(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")                  # 开启所有警告

# 设置可执行文件的输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)

# 添加可执行文件
add_executable(${PROJECT_NAME} main.cpp)

# 添加包含的目录
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thread)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/util)

# 添加源文件
target_sources(${PROJECT_NAME} PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/thread/semaphore.h
    ${CMAKE_CURRENT_SOURCE_DIR}/thread/thread_pool.h
    ${CMAKE_CURRENT_SOURCE_DIR}/util/file_path.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/util/file_path.h
    ${CMAKE_CURRENT_SOURCE_DIR}/util/file.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/util/file.h
    ${CMAKE_CURRENT_SOURCE_DIR}/util/gzstream.h
    ${CMAKE_CURRENT_SOURCE_DIR}/util/logger.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/util/logger.h
    ${CMAKE_CURRENT_SOURCE_DIR}/util/once_token.h
    ${CMAKE_CURRENT_SOURCE_DIR}/util/time_ticker.h
    ${CMAKE_CURRENT_SOURCE_DIR}/util/time_util.h
    ${CMAKE_CURRENT_SOURCE_DIR}/util/util.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/util/util.h
)